package com.aaa.ss;

import com.aaa.ss.config.MyRule;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@MapperScan("com.aaa.ss.dao")
@EnableTransactionManagement
@RibbonClient(name = "salesClient",configuration = MyRule.class)
@EnableEurekaClient
@EnableCircuitBreaker //断路器
public class SalesApp {
    public static void main(String[] args) {
        SpringApplication.run(SalesApp.class,args);
    }

    /**
     * 初始化RestTemplate
     * @return
     */
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}

